package com.example.amazlinglistview.task;

import com.example.amazlinglistview.MainActivity;
import com.example.amazlinglistview.domain.Constants;

import android.os.Message;
import android.util.Log;

public class MyHandler extends android.os.Handler {
	private static final String TAG = "MyHandler";
	private MainActivity mContext;

	public static int DATA_STATE = 0;
	public static final int SERIES_READY = 1;
	public static final int SERIES_FAILED = -1;
	public static final int DEALERS_READY = 2;
	public static final int DEALERS_FAILED = -2;

	public MyHandler(MainActivity context) {
		this.mContext = context;
	}

	@Override
	public void handleMessage(Message msg) {
		int what = msg.what;
		switch (what) {
		case SERIES_READY:
			DATA_STATE = SERIES_READY;
			mContext.initData();
			break;
		case DEALERS_READY:
			DATA_STATE = DEALERS_READY;
			mContext.initData();
			break;
		case Constants.DEALER_STATE_4S:
			Log.i(TAG, "4s checked");
			break;
		case Constants.DEALER_STATE_COMPRE:
			Log.i(TAG, "compre checked");
			break;
		case Constants.SORT_STATE_DISTANCE:
			Log.i(TAG, "distance checked");
			break;
		case Constants.SORT_STATE_HOT:
			Log.i(TAG, "hot checked");
			break;
		case Constants.SORT_STATE_PRICE:
			Log.i(TAG, "price checked");
			break;

		}
	}
}
